package com.quickask.dao;

import com.quickask.entity.AsknowCollectionEntity;
import com.quickask.idao.ICollectionDao;

import java.util.List;

/**
 * Created by Administrator on 2015/9/30.
 */
public class CollectionDao extends BaseDao<AsknowCollectionEntity, Integer> implements ICollectionDao {
    /**
     * 添加问题收藏
     *
     * @param asknowCollectionEntity 收藏实体
     */
    @Override
    public void addCollectedItem(AsknowCollectionEntity asknowCollectionEntity) {
        save(asknowCollectionEntity);
    }

    /**
     * 获取用户收藏列表
     *
     * @param userId 用户id
     */
    @Override
    public List<AsknowCollectionEntity> getCollectedItemList(int userId) {
        return getListByHQL("from AsknowCollectionEntity as ace where ace.userId = ? and collectionIsAlive = 1", userId);
    }
}
